<?php

/**
 * TbsClienteTamBd filter form base class.
 *
 * @package    AltargetEcommerce
 * @subpackage filter
 * @author     Carlo Lopez
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTbsClienteTamBdFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cltb_fechaini'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cltb_fechafin'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cltb_fechagen'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cltb_maxenvios' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cltb_status'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cltb_origen'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cltb_codcli'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_cltb_codcli'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'cltb_fechaini'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'cltb_fechafin'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'cltb_fechagen'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'cltb_maxenvios' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cltb_status'    => new sfValidatorPass(array('required' => false)),
      'cltb_origen'    => new sfValidatorPass(array('required' => false)),
      'cltb_codcli'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_cltb_codcli'), 'column' => 'cli_codigo')),
    ));

    $this->widgetSchema->setNameFormat('tbs_cliente_tam_bd_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TbsClienteTamBd';
  }

  public function getFields()
  {
    return array(
      'cltb_codigo'    => 'Number',
      'cltb_fechaini'  => 'Date',
      'cltb_fechafin'  => 'Date',
      'cltb_fechagen'  => 'Date',
      'cltb_maxenvios' => 'Number',
      'cltb_status'    => 'Text',
      'cltb_origen'    => 'Text',
      'cltb_codcli'    => 'ForeignKey',
    );
  }
}
